<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style-type: none;
        }
        body{
            background:url(1.jpg);
           
        }
        .a{
            width: 600px;
            height: 600px;
            margin: auto;
        }
        li{
            height: 190px;
            width: 190px;
            background-color: rgb(0, 255, 149);
            margin: 5px 5px 5px 5px;
            float: left;
        }
        #start{
            cursor: pointer;
            font-size:40px;
            color: white;
            text-align: center;
            line-height: 170px;
        }
        #stop{
            cursor: pointer;
            font-size:40px;
            color: white;
            text-align: center;
            line-height: 170px;
        }
        #start:hover{
            background-color: rgb(94, 81, 141);
        }
        .fun1{
            background-color: burlywood;
        }
        .fun2{
            background-color: rgb(0, 255, 149);;
        }
    </style>
</head>
<body>
    <div class="a">
        <ul id="b">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li id="start">开始</li>
            <li></li>
            <li></li>
            <li></li>
            <li id="stop">停止</li>
        </ul>
    </div>
    <script>
        var a=document.getElementById('start');
        var v=document.getElementById('stop');
        var bb=document.getElementsByTagName("li");
        var num=-1;
        var count=0;
        var time;
        a.onclick=function(){
            time=setInterval(function(){
                
                    count++;
                    bb[0].className="fun1"; 
                    num++;
                    if(num>9){
                        num=0;
                    }
                   
                    bb[num-1].className="fun2";
                    bb[num].className="fun1"; 
                    bb[0].className="fun2"; 
                    if(num==4){
                        bb[4].className="fun2";
                    }
                },200)
        }
        v.onclick=function(){
            clearInterval(time)
        }
        
        
    </script>
</body>
</html>